/*
验证功能:
    vector<>::clear() 清空数据, 不释放内存, 改变大小为0
*/
#include <iostream>
#include <vector>
#include <stdio.h>
using namespace std;

int main() {
    vector<int> v1 = { 1, 2, 3, 4, 5 };
    printf("原始大小 size=%ld, capacity=%ld\n", v1.size(), v1.capacity());
    v1.clear();
    printf("clear清空 size=%ld, capacity=%ld\n", v1.size(), v1.capacity());

    return 0;
}

/* 运行结果:
原始大小 size=5, capacity=5
clear清空 size=0, capacity=5
*/